package com.hm.common.plugin.oss;

import com.hm.common.autoconfigure.CommonProperties;
import lombok.Setter;

/**
 * @author shishun.wang
 * @version 1.0
 * @date 2019/4/11 11:42
 * @describe
 */
public class OssCloudBootstrap {
	
	private CommonProperties commonProperties;
	
	private OssCloudFactory.OssCloudType DEFAULT_OSS_CLOUD_TYPE = OssCloudFactory.OssCloudType.QI_NIU;
	
	public OssCloudBootstrap(CommonProperties commonProperties){
		this.commonProperties = commonProperties;
	}
	
	public OssCloudAbs getOssCloud() {
		if (null == commonProperties.getPlugin().getOssCloudConfig().getCloudType()) {
			return OssCloudFactory.getOssCloud(DEFAULT_OSS_CLOUD_TYPE, commonProperties);
		}
		return OssCloudFactory.getOssCloud(commonProperties.getPlugin().getOssCloudConfig().getCloudType(), commonProperties);
	}
	
}